package Server

import (
	"github.com/gogf/gf/v2/util/gconv"
	"github.com/wzh200x/hyperNexus/hyperNexusModel"
	"github.com/wzh200x/hyperNexus/hyperNexusProtocol/commonProtocol"
)

func FormatAccountResponse(e *hyperNexusModel.Account, output *commonProtocol.Account) {
	output.ID = e.ID
	output.CreateTime = e.CreatedAt.Format("2006-01-02 15:04:05")
	output.UpdateTime = e.UpdatedAt.Format("2006-01-02 15:04:05")
	output.AccountName = e.AccountName
	output.PassWord = e.PassWord
	output.ThirdPlatformType = gconv.Int32(e.ThirdPlatformType)
	output.ThirdPlatform = e.ThirdPlatform
	output.ThirdAccount = e.ThirdAccount
	output.ThirdToken = e.ThirdToken
	output.ThirdRefreshToken = e.ThirdRefreshToken
	output.ThirdTokenExpireTime = e.ThirdTokenExpireTime
	output.ThirdSessionKey = e.ThirdSessionKey
	output.ThirdActiveReport = e.ThirdActiveReport
	output.LoginTime = e.LoginTime.Format("2006-01-02 15:04:05")
	output.LogoutTime = e.LogoutTime.Format("2006-01-02 15:04:05")
	output.AvatarId = e.AvatarId
	output.HyperNexusAvatarId = e.HyperNexusAvatarId
	output.AvatarIds = gconv.Int64s(e.AvatarIds)
}

func FormatAvatarResponse(e *hyperNexusModel.Avatar, output *commonProtocol.Avatar) {
	output.ID = e.ID
	output.CreateTime = e.CreatedAt.Format("2006-01-02 15:04:05")
	output.UpdateTime = e.UpdatedAt.Format("2006-01-02 15:04:05")
	output.HyperNexusAvatarId = e.HyperNexusAvatarId
	output.Name = e.Name
	output.Data = e.Data
	output.UseServer = gconv.Int32(e.UseServer)
}
